package com.tony.lock;

import java.util.concurrent.CountDownLatch;

/**
 * @author tonywang
 * @date 8/15/2018
 */
public class CountDownLatchTest {
    static CountDownLatch countDownLatch = new CountDownLatch(2);

    public static void main(String[] args) throws InterruptedException {
        new Thread(()->{
            System.out.println("1");
            countDownLatch.countDown();
            System.out.println("2");
            countDownLatch.countDown();
        }).start();
        countDownLatch.await();
        System.out.println("3");
    }
}
